Skip to content

feat(site-migrator)!: extract BlockTargetAdapter to decouple BurgerEditor conversion - #1007

Merged
YusukeHirao merged 1 commit into
devfrom
worktree-fizzy-zooming-sloth
Aug 11, 2026
Merged

feat(site-migrator)!: extract BlockTargetAdapter to decouple BurgerEditor conversion#1007
YusukeHirao merged 1 commit into
devfrom
worktree-fizzy-zooming-sloth

Conversation

@YusukeHirao

Copy link
Copy Markdown
Member

Summary

  • Extract BurgerEditor-specific conversion (classify/rewriteRefs/render/downloadFiles) out of extractPages/migrate into a pluggable BlockTargetAdapter<TBlocks> interface (src/adapter.ts), so a future non-BurgerEditor block CMS target can reuse the shared nitpicker-archive/anatomist/id-assignment/frontmatter/write pipeline without depending on @burger-editor/core.
  • Add burgerEditorAdapter (src/page-extractor/burger-editor-adapter.ts) as the built-in default implementation, composed from the existing layoutToBlockData/rewriteBlockRefs/renderBlocks/downloadBlockFiles functions (unchanged).
  • adapter is now a required option on extractPages and migrate. dz-migrate CLI now passes burgerEditorAdapter explicitly.
  • isMainConsistent's anatomist/extractMainContent consistency check stays in the adapter-agnostic shared layer (extractPages), since it doesn't depend on the target block shape.
  • Unified the two "no conversion happened" code paths (main not found / adapter classify fatal) into one internal RawFallback helper in extract-pages.ts.

Breaking change

adapter is a required parameter on extractPages/migrate. No migration guide is provided — site-migrator is still 5.x-alpha and not yet consumed by any other package/service.

Test plan

  • yarn build (type-checks site-migrator)
  • yarn lint
  • yarn test (357 tests, including 2 new tests in extract-pages.spec.ts and 1 new test in migrate.spec.ts using a non-BurgerEditor fake adapter to prove extractPages/migrate genuinely forward options.adapter instead of hardcoding burgerEditorAdapter)

…itor conversion

extractPages/migrate no longer hardcode BurgerEditor's classify/rewriteRefs/render/
downloadFiles pipeline. They now delegate to a required `adapter` option
(BlockTargetAdapter<TBlocks>), with burgerEditorAdapter providing the existing
BurgerEditor behavior as the built-in implementation. Archive access, anatomist
wiring, id assignment, frontmatter generation, and same-origin ref rewriting stay
as adapter-agnostic shared logic, so a future non-BurgerEditor target can reuse
them without depending on @burger-editor/core.

BREAKING CHANGE: `adapter` is now a required option on `extractPages` and
`migrate`. Existing callers (including `dz-migrate`) must pass `burgerEditorAdapter`
explicitly. No migration guide is provided (package is still 5.x-alpha and unused
by any consumer).
@YusukeHirao
YusukeHirao merged commit c66e358 into dev Aug 11, 2026
1 check passed
@YusukeHirao
YusukeHirao deleted the worktree-fizzy-zooming-sloth branch August 11, 2026 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant